DEFINITION MODULE MenuMgr;     (* Christoph Fleischer 01.02.85 *)
                               (* MacIntosh Toolbox Menu Manager Routines *)
                               (* last modification   15.05.85 fxk*)

FROM SYSTEM IMPORT ADDRESS;
FROM MacBase IMPORT LongInt,Handle;
FROM QuickDraw IMPORT Style,Point;
IMPORT MacBase;
EXPORT QUALIFIED
     noMark,checkMark,appleSymbol,cmdSymbol,textMenuProc,maxItem,
     mDrawMsg,mChooseMsg,mSizeMsg,
     MenuHandle,MenuPtr,MenuInfo,StrPtr,
     InitMenus,NewMenu,GetMenu,DisposeMenu,AppendMenu,AddResMenu,InsertResMenu,
     InsertMenu,DrawMenuBar,DeleteMenu,ClearMenuBar,GetNewMBar,GetMenuBar,
     SetMenuBar,MenuSelect,MenuKey,HiliteMenu,SetItem,GetItem,DisableItem,
     EnableItem,CheckItem,SetItemIcon,GetItemIcon,SetItemStyle,GetItemStyle,
     SetItemMark,GetItemMark,SetMenuFlash,CalcMenuSize,CountMItems,GetMHandle,
     FlashMenuBar;

CONST
  noMark      =  0;  appleSymbol = 20;        (* mark symbols for MarkItem *)
  cmdSymbol   = 17;  checkMark   = 18;

  textMenuProc=  0; maxItem     = 31;         (* max number of items in a text menu *)

  mDrawMsg    =  0;  mChooseMsg  =  1;  mSizeMsg    =  2;(* menu defProc messages *)

TYPE
  Ptr=ADDRESS;StrPtr = MacBase.StrPtr; (* pointer to a Pascal String *)
  ResType = MacBase.OsType;
  MenuHandle  = POINTER TO MenuPtr;
  MenuPtr     = POINTER TO MenuInfo;
  MenuInfo    = RECORD
                  menuId:       INTEGER;
                  menuWidth:    INTEGER;
                  menuHeight:   INTEGER;
                  menuProc:     Handle;
                  enableFlags:  ARRAY[0..1] OF BITSET;
                  menuData:     ARRAY[0..255] OF CHAR;
                END;


PROCEDURE InitMenus;                                          (*INLINE $A930*)
PROCEDURE NewMenu(menuID: INTEGER; menuTitle: StrPtr): MenuHandle;(*INLINE $A931*)
PROCEDURE GetMenu(menuID:  INTEGER): MenuHandle;              (*INLINE $A9BF*)
PROCEDURE DisposeMenu(menu: MenuHandle);                      (*INLINE $A932*)
PROCEDURE AppendMenu(menu: MenuHandle; data: StrPtr);      (*INLINE $A933*)

PROCEDURE InsertMenu (menu: MenuHandle; beforeId: INTEGER);   (*INLINE $A935*)
PROCEDURE DeleteMenu (menuId: INTEGER);                       (*INLINE $A936*)
PROCEDURE DrawMenuBar;                                        (*INLINE $A937*)
PROCEDURE ClearMenuBar;                                       (*INLINE $A934*)

PROCEDURE GetMenuBar():Handle;                                (*INLINE $A93B*)
PROCEDURE GetNewMBar(menuBarID:  INTEGER): Handle;            (*INLINE $A9C0*)
PROCEDURE SetMenuBar(menuBar: Handle);                        (*INLINE $A93C*)

PROCEDURE MenuSelect (startPt: Point): LongInt;               (*INLINE $A93D*)
PROCEDURE MenuKey    (ch: CHAR): LongInt;                     (*INLINE $A93E*)
PROCEDURE HiliteMenu (menuId: INTEGER);                       (*INLINE $A938*)

PROCEDURE SetItem    (menu: MenuHandle; item: INTEGER; itemString: StrPtr);
                                                              (*INLINE $A947*)
PROCEDURE GetItem    (menu: MenuHandle; item: INTEGER; itemString: StrPtr);
                                                              (*INLINE $A946*)
PROCEDURE EnableItem (menu: MenuHandle; item: INTEGER);       (*INLINE $A939*)
PROCEDURE DisableItem(menu: MenuHandle; item: INTEGER);       (*INLINE $A93A*)
PROCEDURE CheckItem  (menu: MenuHandle; item: INTEGER; checked: BOOLEAN);
                                                              (*INLINE $A945*)

PROCEDURE SetItemIcon(menu: MenuHandle; item: INTEGER; iconNum: INTEGER);
                                                              (*INLINE $A940*)
PROCEDURE GetItemIcon(menu: MenuHandle; item: INTEGER; VAR iconNum: INTEGER);
                                                              (*INLINE $A93F*)
PROCEDURE SetItemStyle(menu: MenuHandle; item: INTEGER; styleVal: Style);
                                                              (*INLINE $A942*)
PROCEDURE GetItemStyle(menu: MenuHandle; item: INTEGER; VAR styleVal: Style);
                                                              (*INLINE $A941*)
PROCEDURE SetItemMark(menu: MenuHandle; item: INTEGER; markChar: CHAR);
                                                              (*INLINE $A944*)
PROCEDURE GetItemMark(menu: MenuHandle; item: INTEGER; VAR markChar: CHAR);
                                                              (*INLINE $A943*)
PROCEDURE SetMenuFlash(menu: MenuHandle; flashCount: INTEGER);(*INLINE $A94A*)
PROCEDURE FlashMenuBar(menuID: INTEGER);                      (*INLINE $A94C*)

PROCEDURE GetMHandle(menuID: INTEGER): MenuHandle;            (*INLINE $A949*)
PROCEDURE CountMItems(menu:  MenuHandle):  INTEGER;           (*INLINE $A950*)
PROCEDURE AddResMenu(menu: MenuHandle; theType:ResType);      (*INLINE $A94D*)
PROCEDURE InsertResMenu(menu: MenuHandle; theType:ResType; afterItem: INTEGER);
                                                              (*INLINE $A951*)
PROCEDURE CalcMenuSize(menu: MenuHandle);                     (*INLINE $A948*)

END MenuMgr.
